import request from '@/utils/request'
import qiniuRequest from '@/utils/qiniuRequest'

export function getQiniuToken() {
  return request({
    url: '/publish/upload/',
    method: 'get',
    params: {
      type: 'token'
    }
  })
}

export function getQiniuDomain() {
  return request({
    url: '/publish/domain/',
    method: 'get'
  })
}

export function checkFileUploaded(hash) {
  return request({
    url: '/publish/file-hash/',
    method: 'get',
    params: {
      hash
    }
  })
}

export function createFileHash(data = { file_hash: null, file_key: null }) {
  return request({
    url: '/publish/file-hash/',
    method: 'post',
    data
  })
}

export function uploadFile(data) {
  return qiniuRequest({
    url: '/',
    method: 'post',
    data
  })
}


